# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvs/zport/sci-libs/cudd/cudd-2.4.1.ebuild,v 1.1.1.1 2006/11/22 16:05:34 zechs Exp $

inherit eutils

DESCRIPTION="CUDD - CU decision diagram package"
HOMEPAGE="http://vlsi.colorado.edu/~fabio/CUDD/"
SRC_URI="ftp://vlsi.colorado.edu/pub/${P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="x86 sparc"

IUSE="dynamic"
DEPEND="virtual/libc"

src_unpack() {
	unpack ${A}
	cd ${S} || die
	epatch ${FILESDIR}/${P}-gentoo.diff
}

src_compile() {
	if use sparc; then
		echo "Hello World!"
		sed -i -e 's:XCFLAGS\t= -march=i686:#XCFLAGS\t= -march=i686:' ${S}/Makefile
		sed -i -e 's:#XCFLAGS\t= -mcpu=ultrasparc:XCFLAGS\t= -mcpu=ultrasparc:' ${S}/Makefile
	fi
	make || die
}

src_install() {
	install -d ${D}usr/lib/${PN} ${D}usr/include/${PN}

	make PREFIX=${D}/usr install-static || die
	make PREFIX=${D}/usr install-headers || die

	if use dynamic; then
		make PREFIX=${D}/usr install-dynamic || die
		echo ${FILESDIR}/99${PN}
		insinto /etc/env.d
		doins ${FILESDIR}/99${PN}
	fi
}

